nav ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    float: left;
    position: relative;
}

nav ul li a {
    display: block;
    padding: 10px;
    text-decoration: none;
    color: #000;
    background-color: #f2f2f2;
}

nav ul li:hover>a {
    background-color: #ddd;
}

nav ul li:hover .submenu {
    display: block;
}

nav ul .submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    padding: 0;
    background-color: #f2f2f2;
}

nav ul .submenu li {
    float: none;
}

nav ul .submenu li a {
    padding: 10px;
    color: #000;
}

nav ul .submenu li a:hover {
    background-color: #ddd;
}